home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_03
/
9n03075a
< prev
next >
Wrap
Text File
|
1990-12-07
|
1KB
|
82 lines
;
; _cio - console i/o for embedded system example
; near version
;
_TEXT segment byte public 'CODE'
DGROUP group _DATA,_BSS
assume cs:_TEXT,ds:DGROUP,ss:DGROUP
_TEXT ends
_DATA segment word public 'DATA'
_DATA ends
_BSS segment word public 'BSS'
_BSS ends
_TEXT segment byte public 'CODE'
;
; _cin - input to console
; near version
;
__cin proc near
public __cin
push bp ; perform c entry
mov bp,sp
push bx ; save bx for c
mov ah,0h ; get the byte
mov bx,7
int 16h ; using the bios
mov ah,0 ; "sign extend" - convert to int
pop bx ; restore context
pop bp
ret
__cin endp
;
; _cout - output to console
; near version
;
__cout proc near
public __cout
push bp ; c entry
mov bp,sp
push bx ; save register for c
mov ax,word ptr [bp+4] ; get c
mov ah,0eh ; and output the byte
mov bx,7
int 10h ; call bios
pop bx ; restore context
pop bp
ret
__cout endp
;
; _cinit - console initialization
; **** No initialization required for bios version ****
;
; near version
;
__cinit proc near
public __cinit
push bp
; perform any required hardware initialization here
mov ax,1 ; return true for success
pop bp
ret
__cinit endp
_TEXT ends
end